Create a new user
This request is used to create a record for a client's new user.
Request syntax
POST https://business.taxi.yandex.ru/api/1.0/client/{client ID}/user/
🔴 We recommend using API 2.0. API 1.0 support will be discontinued in the future.
Request headers:
Authorization
OAuth access token. The steps to get a token are described in Getting started.
Data for the new user is passed in the request body in JSON format:
|
Field |
Description |
Format |
|
|
The user's email address. Mandatory field. Can be an empty string. |
String |
|
|
The user's full name. Mandatory field. Can be an empty string. |
String |
|
|
The user's short name. Optional field. |
String |
|
|
The user's phone number. Mandatory field. |
String |
|
|
Indicates that the user is active. Mandatory field. |
Logical |
|
|
Department identification number. Optional field. |
String |
|
|
A block with information about the user's role. Mandatory field.
|
Object |
|
|
The user role ID number. |
String |
|
|
A list of classes available to the user. Pass this field if the |
Array |
|
|
The limits on the amount a user can spend on rides in a calendar month. Optional field. |
String |
|
|
The default name of the client's cost center. Optional field. |
String |
|
|
Information about available cost centers. Optional field. Contains the following fields:
|
Object |
Response field description
Responses may contain the following fields:
| Field | Description | Format |
|---|---|---|
_id |
The user's ID number. | String |
Example requests
Request specifying an existing role:
POST https://business.taxi.yandex.ru/api/1.0/client/a2d...d09/user/
...
Authorization: <OAuth token>
{
"email": "example-mail@example-company.ru",
"fullname": "Ilya Ivanov",
"nickname": "IIlya",
"department_id": "233e725b0511459da7b38cb24f2d8fd7",
"role": {
"role_id": "620d2b39bb154e3ebe5debc8341b3471"
},
"phone": "+75551234567",
"is_active": false,
"cost_center": "some cost center",
"cost_centers": {
"required": true,
"format": "mixed",
"values": ["cost center 1", "cost center 2"]
}
}
Request specifying a new role:
POST https://business.taxi.yandex.ru/api/1.0/client/a2...d09/user/
...
Authorization: <OAuth token>
{
"email": "example-mail@example-company.ru",
"fullname": "Ilya Ivanov",
"nickname": "IIlya",
"department_id": "620d2b39bb154e3ebe5debc8341b3471",
"role": {
"limit": 10000,
"classes": ["econom"],
"restrictions": [
{
"days": ["mo", "we", "sa"],
"start_time": "00:00:00",
"end_time": "23:59:00",
"type": "weekly_date"
}
],
"geo_restrictions": [
{
"source": "geo_restriction_id1",
"destination": "geo_restriction_id2";
},
{
"source": "geo_restriction_id3";
}
]
},
"phone": "+75551234567",
"is_active": false,
"cost_center": "some cost center",
"cost_centers": {
"required": true,
"format": "mixed",
"values": ["cost center 1", "cost center 2"]
}
}
Response example
An example response to this request looks like this:
{
"_id": "3caa3587675b49deb62e3286b753b05e"
}
Response codes
The response to this request may contain the following standard HTTP codes:
200: Request completed successfully.400: An unknown parameter or a parameter with an invalid value was passed in the request.401: The OAuth token is incorrect.403: The client doesn't have sufficient rights to execute this request.406: A record with the specified parameters already exists.